package com.xxx.common;

import org.springframework.stereotype.Component;

@Component
public class ResultUtil {
    public static Result success(Object object) {
        Result result = new Result();
        result.setCode(ResultEnum.SUCCESS.getCode());
        result.setMsg(ResultEnum.SUCCESS.getMsg());
        result.setData(object);
        return result;
    }

    public static Result success(){
        return success(null);
    }


    public static Result userNotExist() {
        Result result = new Result();
        result.setCode(ResultEnum.USER_NOT_EXIST.getCode());
        result.setMsg(ResultEnum.USER_NOT_EXIST.getMsg());
        return result;
    }

    public static Result error(Integer code, String msg) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;

    }
}
